<template>
  <el-menu :default-openeds="['1', '3']" style="min-height: 100vh; overflow-x: hidden"

           background-color="rgb(48,65,86)"
           text-color="#fff"
           active-text-color="#ffd04b"
           :collapse-transition="false"
           :collapse="isCollapse"
           router
           @select="handleSelect"
  >

    <div style="height: 60px; line-height: 60px; text-align: center">
      <img src="../assets/logo.png" style="width: 20px; position: relative; top: 5px; margin-right: 5px">
      <b style="color: white" v-show="logoTextShow">后台管理系统</b>
    </div>


    <!--    <el-menu-item  index="/person">-->
    <!--      <template slot="title"><i class="el-icon-moon"></i>-->
    <!--        <span>个人信息</span>-->
    <!--      </template>-->
    <!--    </el-menu-item>-->

    <!--    <el-submenu index="2">-->
    <!--      <template slot="title"><i class="el-icon-menu"></i>-->
    <!--        <span>系统管理</span>-->
    <!--      </template>-->

    <!--      <el-menu-item-group>-->
    <el-menu-item index="/user">
      <template slot="title"><i class="el-icon-s-custom"></i>
        <span>所有用户</span>
      </template>
    </el-menu-item>

    <el-menu-item index="/admin" :hidden="this.hidden">
      <template slot="title"><i class="el-icon-s-custom"></i>
        <span>用户管理</span>
      </template>
    </el-menu-item>

    <el-submenu index="3">
      <template slot="title"><i class="el-icon-menu"></i>
        <span>公厕管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/wc">
          <template slot="title"><i class="el-icon-document"></i>
            <span>公厕基本信息管理</span>
          </template>
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-menu-item index="" >
      <template slot="title"><i class="el-icon-s-custom"></i>
        <span>轮播图管理</span>
      </template>
    </el-menu-item>



  </el-menu>
</template>

<script>
import router from "@/router";

export default {
  name: "Aside",
  props: {
    isCollapse: Boolean,
    logoTextShow: Boolean
  },
  methods: {},
  data() {
    return {
      //模糊用户名查询用
      user: "",
      phone: "",
      //表格数据
      tableDate: [],
      role: '',
      hidden: ''
    }
  },
  created() {
    //从前端拿到user对象 登陆时进行了存储
    let user = localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : null
    console.log("从本地拿到的是", user)
    if (user) {
      this.role = user.role;  // 设置请求头
    }
    //只有为超级管理员才可以管理用户
    if (this.role === 2) {
      this.hidden = false;
    } else {
      this.hidden = true;
    }
    console.log(this.hidden + this.role + "qweqweqweqwe")
  }
}
</script>

<style scoped>
</style>
